using UnityEngine;
using System.Collections;

public class PressureTrigger: Trigger
{
	private bool pressedOn=false;
	private bool justChanged=false;
	
	public void OnCollisionEnter(Collision collisionInfo)
	{
		
		if(transform.position.y<collisionInfo.contacts[0].point.y)
		{
			pressedOn=true;
			justChanged=true;
		}
	}
	
	public void OnCollisionExit(Collision collisionInfo)
	{
		pressedOn=false;
		justChanged=true;
	}
	
	
	public override TriggeredEvent hasReachedGoal()
	{
		if(justChanged)
		{
			justChanged=false;
			TriggeredEvent te=new TriggeredEvent();
			te.hasMetGoal=pressedOn;
			return te;
		}
		return null;
	}
		
}
